import { contextBridge, nativeImage } from "electron";

import type { ElectronNative } from "@common/ipc-types.ts";
import { dialogInvoker, ipcInvoker, webUtilsInvoker } from "./preload/electron.ts";
import { shellInvoker } from "./preload/shell.ts";
import { cpInvoker, fsInvoker } from "./preload/node.ts";
import { httpInvoker } from "./preload/http.ts";
import { archivesInvoker } from "./preload/archives.ts";

const native: ElectronNative = {
  ipc: ipcInvoker,
  webUtils: webUtilsInvoker,
  nativeImage: nativeImage,
  shell: shellInvoker,
  dialog: dialogInvoker,
  fs: fsInvoker,
  cp: cpInvoker,
  process: process,
  http: httpInvoker,
  archives: archivesInvoker,
};

contextBridge.exposeInMainWorld("native", native);
